require "win32/service"
include Win32

# If we got this far, we are running as a service.
class Daemon
  def service_init
    # Give the service time to get everything initialized and running,
    # before we enter the service_main function.
    sleep 10
  end
  
  def service_main
    require File.dirname(__FILE__) + "/../init.rb"
    ActiveBackground::Server.start()
  end
end

d = Daemon.new
d.mainloop